package rpc.core;

import java.lang.reflect.Method;
import java.util.Objects;

/*********
 *
 *
 *@author 197
 *@date 2020/6/23 8:21
 *
 **/


public class FlowInfo {

  /***
   * 方法名称
   */
  private String flowName;
  /**
   * serviceId_msgId;
   */
  private String smId;
  /****
   * 方法
   */
  private Method method;
  /***
   * 实现对象
   */
  private Object impl;
  private Class<?> reqClass;
  private Class<?> retClass;

  public String getSmId() {
    return smId;
  }

  public FlowInfo setSmId(String smId) {
    this.smId = smId;
    return this;
  }

  public Method getMethod() {
    return method;
  }

  public FlowInfo setMethod(Method method) {
    this.method = method;
    return this;
  }

  public Object getImpl() {
    return impl;
  }

  public FlowInfo setImpl(Object impl) {
    this.impl = impl;
    return this;
  }

  @Override
  public int hashCode() {
    return Objects.hash(getFlowName());
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof FlowInfo)) {
      return false;
    }
    FlowInfo flowInfo = (FlowInfo) o;
    return getFlowName().equals(flowInfo.getFlowName());
  }

  public String getFlowName() {
    return flowName;
  }

  public FlowInfo setFlowName(String flowName) {
    Objects.requireNonNull(flowName, "flowName is null");
    this.flowName = flowName;
    return this;
  }

  public Class<?> getReqClass() {
    return reqClass;
  }

  public FlowInfo setReqClass(Class<?> reqClass) {
    this.reqClass = reqClass;
    return this;
  }

  public Class<?> getRetClass() {
    return retClass;
  }

  public FlowInfo setRetClass(Class<?> retClass) {
    this.retClass = retClass;
    return this;
  }
}
